﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;

namespace EBA.Localization
{
    /// <summary>
    /// 本地化
    /// </summary>
    public interface ILocalizationProvider
    {
        /// <summary>
        /// 已经存在的语言文化列表
        /// </summary>
        IEnumerable<CultureInfo> GetCultures();

        /// <summary>
        /// 获取指定语言文化的资源主键列表
        /// </summary>
        /// <returns></returns>
        IQueryable<string> GetKeys(CultureInfo culture = null);

        /// <summary>
        /// 读取指定主键的文本
        /// </summary>
        /// <param name="culture">语言文化</param>
        /// <param name="key">主键</param>
        /// <returns></returns>
        string GetTextValue(string key, CultureInfo culture = null);

        /// <summary>
        /// 翻译
        /// </summary>
        /// <param name="key"></param>
        /// <param name="culture"></param>
        /// <param name="defaultText"></param>
        /// <returns></returns>
        string Translate(string key, CultureInfo culture, string defaultText = null);

        /// <summary>
        /// 更新翻译
        /// </summary>
        /// <param name="key">主键</param>
        /// <param name="culture">语言</param>
        /// <param name="text">翻译</param>
        void Update(string key, CultureInfo culture, string text);


    }
}
